The invention relates generally to vertex information processing in video graphics systems. More particularly, the present invention relates to a method and apparatus for selectively providing drawing commands to the system""s graphics processing engine to improve system processing efficiency.
Video graphics systems are commonly used to display two-dimensional (2D) and three-dimensional (3D) objects on display devices, such as computer monitors and television screens. Such systems receive drawing commands and object configuration information from software applications, such as video games or Internet browser applications, process the commands based on the object configuration information, and provide appropriate signals to the display devices to illuminate pixels on the device screens, thereby displaying the objects. A block diagram for a typical video graphics system 100 is depicted in FIG. 1. The video graphics system 100 includes, inter alia, a host processing unit 101, a peripheral component interconnect (PCI) bus 103, a graphics processor 105, memory 107, 109 and a display device 111. The graphics processor 105 is typically located on a video card 113 together with local memory 109 that is accessed and used regularly by the graphics processor 105.
The PCI bus 103 typically includes appropriate hardware to couple the host processing unit 101 to the system memory 107 and the graphics processor 105, and to couple the graphics processor 105 to the system memory 107. For example, depending on the system configuration, the PCI bus 103 may include a memory and bus controller integrated circuit (IC) and an accelerated graphics port (AGP) bus to facilitate direct memory access (DMA) transfers of data stored in the system memory 107 to the graphics processor 105. The display device 111 is typically a conventional cathode ray tube (CRT) display, liquid crystal display (LCD), or other display. Although not shown for purposes of clarity, other components, such as a video frame buffer, a video signal generator, and other known 3D pipeline components, are commonly incorporated between the graphics processor 105 and the display device 111 to properly display objects rendered by the graphics processor 105.
The host processing unit 101 is typically a central processing unit (CPU) or an equivalent microprocessor-based computer. The host processing unit 101 generally executes several software applications with respect to video graphics processing, including a host application 115, an operating system runtime layer 117, and a graphics driver application 119. These applications 115-119 are typically stored on the hard disk component of the system memory 107, a memory card, a floppy disk, a CD-ROM, or some other computer-readable storage medium. The host application 115 is the application that initiates all drawing commands and provides all information necessary for the other graphics applications and processing components to display objects on the display device 111. For example, the host application 115 might be a word processing application, a video game, a computer game, a spreadsheet application, or any other application that requires two-dimensional or three-dimensional objects to be displayed on a display device 111.
In graphics systems, each object to be displayed is typically divided into one or more graphics primitive groups. Common primitive groups include a point list, a line list, and a triangle list. Each primitive group includes a respective number of vertices. For example, a point list primitive group has one or more vertices making up one or more points, a line primitive group has two or more vertices making up one or more lines, and a triangle primitive has three or more vertices making Up one or more triangles. Each vertex has information associated with it to indicate, inter alia, its position in a reference coordinate system and its color. In most applications, such vertex information consists of a vector of multiple parameters to indicate the vertex""s position and other optional properties. For example, the vector may include parameters relating to the vertex""s normal vector, diffuse color, specular color, other color data, texture coordinates, and fog data. Consequently, the host application 115 not only issues drawing commands, but also provides the vertex information for each vertex of each primitive to be drawn to display each object of a graphics scene.
The operating system runtime layer 117 provides a well-defined application programming interface (API) to the host application 115 and a well-defined device driver interface (DDI) to the graphics driver application 119. That is, the operating system runtime layer 117 is a software layer that enables various host applications 115 to interface smoothly with various graphics driver applications 119. One example of an operating system runtime layer application 117 is the xe2x80x9cDIRECTX7xe2x80x9d component application of the xe2x80x9cWINDOWSxe2x80x9d family of operating systems that is commercially available from Microsoft Corporation of Redmond, Wash.
The graphics driver application 119 is the application that provides drawing commands to the graphics processor 105 in a manner understandable by the graphics processor 105. In most circumstances, the graphics driver application 105 and the video card 113 containing the graphics processor 105 are sold as a set to insure proper operation of the graphics rendering portion of the system (i.e., the portion of the graphics system 100 that receives vertex information from the host application 115, processes the vertex information, and generates the appropriate analog signals to illuminate the pixels of the display device 111 as indicated in the vertex information).
During its execution, the host application 115 stores vertex information in either the system memory 107 or the local memory 109 on the video card 113. To store the vertex information, the host application 115 first requests allocation of portions of the respective memory 107, 109 and then stores the vertex information in the allocated portions. The allocated portions of memory 107, 109 are typically referred to as vertex buffers (VBs) 125. In addition, the host application 115 stores transformation matrices in either the system memory 107 or the local memory 109 on the video card 113. The transformation matrices are used by the graphics processor 105 to transform the position vector of each vertex from the so-called xe2x80x9cmodelxe2x80x9d coordinate system (i.e., the reference coordinate system used by the application 115 to construct the primitives of the object) to the so-called xe2x80x9ceyexe2x80x9d or xe2x80x9cviewxe2x80x9d coordinate system (i.e., the coordinate system used to construct objects in the viewing frustum of the display device 111).
The transformed coordinates in the view coordinate system, or view coordinates, properly position each vertex either inside or outside the viewing frustum of the display device 111. As is known, the viewing frustum is the theoretical volume in which objects or graphics primitives can be seen by a user when the user views the display device 111. Thus, the viewing frustum sets the maximum volume in which primitives or objects should be rendered for display by the graphics processor 105.
Three-dimensional views of typical viewing frustums 201, 202 are illustrated in FIG. 2. The first viewing frustum 201 is typically referred to as a viewing frustum with a perspective projection and is in the general shape of a truncated pyramid. When a graphics system 100 uses this viewing frustum, the graphics processor 105 renders objects that are located further from the vantage point of the viewer""s eye 203 smaller than objects that are located closer to the viewer""s eye 203. The second viewing frustum 202 is typically referred to as a viewing frustum with an orthographic projection and is generally in the shape of a box or three-dimensional rectangle. When a graphics system 100 uses this viewing frustum, the graphics processor 105 renders objects the same size regardless of their distance from the viewer""s eye 203. Each viewing frustum 201, 202 is defined by six respective frustum planes. For example, viewing frustum 201 is defined by planes 205-210 and viewing frustum 202 is defined by planes 212-217.
After the host application 115 stores the vertex information in one or more vertex buffers 125, the host application 115 issues drawing commands to the graphics driver 119 via the runtime layer 117. Each drawing command typically includes an instruction (e.g., xe2x80x9cdrawxe2x80x9d), a memory identification (system memory 107 or video card local memory 109), an address in the identified memory 107, 109 of a vertex buffer 125, and a quantity of vertices in the vertex buffer 125. Upon receiving the commands, the graphics driver 119 processes and reformats the commands into a form executable by the graphics processor 105, and stores the processed/reformatted commands in allocated areas of system memory 107 or video card local memory 109 that are accessible by the graphics processor 105. Such areas of memory 107, 109 are typically referred to as command buffers (CBs) 127. After filling a particular command buffer 127 with a group of drawing commands 201-205, the graphics driver 119 dispatches the command buffer 127 by sending a signal to the graphics processor 105 instructing the processor 105 to fetch and process the commands 201-205 in the command buffer 127. Typically, the graphics driver 119 is filling command buffers 127 faster than the graphics processor 105 can process the drawing commands 201-205 in the buffers 127. Consequently, queuing algorithms are typically employed between the graphics driver 119 and the graphics processor 105 to allow the graphics processor 105 to quickly begin processing a new command buffer 127 upon completion of processing a prior buffer 127. The graphics processor 105 typically processes the command buffers 127 in the order in which they are dispatched by the graphics driver 119.
In the prior art, the graphics driver 119 provides the drawing commands to the graphics processor 105 (i.e., stores the commands in the command buffers 127) regardless of whether or not the object or group of primitives to be rendered is within the viewing frustum 201, 202 of the display device 111. For example, if the graphics system 100 uses viewing frustum 201 and an object 219, 220 to be rendered by a drawing command is located outside of the viewing frustum 201 (e.g., to the viewer side of plane 206 or to the distal side of plane 208), the graphics driver 119 provides the drawing command to render the object 219, 220 to the graphics processor 105. As discussed above, each object 219, 220 is typically divided into several primitives, such as points, lines and/or triangles, and each primitive includes one or more vertices. The graphics processor 105 processes the vertex information for each vertex to create the desired graphics primitives of the object 219, 220 and then compares the positions of the primitives to the viewing frustum 201. If all the primitives of the object 219, 220 are outside the viewing frustum 201 (as would be the case with respect to either object 219 or object 220 because the entire object 219, 220 is outside the viewing frustum 201), the graphics processor 105 discards or deletes all the primitive data for the object 219, 220 so as not to render the object 219, 220. However, such an approach wastes graphics processor resources unnecessarily when an object 219, 220 to be rendered is outside the viewing frustum 201, 202 because the graphics processor 105 processes vertex information related to the object 219, 220 only to later delete or discard it.
Some sophisticated prior art applications 115 determine whether objects are within the viewing frustum 201, 202 before issuing drawing commands for such objects. If an object is outside the viewing frustum 201, 202, the application 115 does not issue the drawing command or commands to display the object. However, many applications 115 are not so sophisticated and issue drawing commands for all objects, leaving the determination of whether or not an object to be rendered is within the viewing frustum 201, 202 of the display device 111 to the graphics processor 105.
Therefore, a need exists for a method and apparatus for selectively providing drawing commands issued by an application to a graphics processor to improve the processing efficiency of a video graphics system, wherein the method and apparatus do not require the graphics processor to unnecessarily process vertex information relating to graphics primitives that are located outside the viewing frustum of a display device.